package com.lemon.blog.web.service.impl;

import com.lemon.blog.web.domain.BlLink;
import com.lemon.blog.web.mapper.BlLinkMapper;
import com.lemon.blog.web.service.IBlLinkService;
import com.lemon.common.core.constant.Constants;
import com.lemon.common.security.service.BaseServiceImpl;
import com.lemon.common.security.utils.OptEntityUtils;
import com.lemon.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 包名称：com.lemon.blog.service.impl
 * 类名称：BlLinkServiceImpl
 * 类描述：友情链接Service业务层处理
 * 创建人：@author huangpeng
 * 创建时间：2022-05-04
 */
@Service
public class BlLinkServiceImpl extends BaseServiceImpl<BlLink> implements IBlLinkService {

    @Autowired
    private BlLinkMapper blLinkMapper;

    @Override
    public List<BlLink> selectBlLinkList(BlLink blLink)
    {
        blLink.setLinkStatus(Constants.STR_ONE);
        return blLinkMapper.selectBlLinkList(blLink);
    }

    @Override
    public int insert(BlLink model) {
        model.setUserId(String.valueOf(SecurityUtils.getWebUserId()));
        model.setEnable(Constants.STR_ZERO);
        model.setLinkStatus(Constants.STR_TWO);
        OptEntityUtils.preInsert(model);
        return blLinkMapper.insertSelective(model);
    }
}
